<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="./layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
    
   
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
    <legend>商品详细页</legend>
  </fieldset> 
   
  <div class="layui-row">
      <div class="layui-row grid-demo">
        <div class="layui-col-md12">
          <div class="grid-demo" style="background-color"></div>
        </div>
        <div class="layui-col-md6">
          <div class="grid-demo grid-demo-bg1" style="background-color: chartreuse">
               <div class="layui-carousel" id="test10">
                    <div carousel-item="">
                      <div><img src="img/1547197575483.jpeg" height="-1" width="-1"></div>
                      <div><img src="img/1547198219157.jpeg" height="-1" width="-1"></div>
                      <div><img src="img/1547198219157.jpeg" height="-1" width="-1"></div>
                      <div><img src="img/1547198250808.jpeg" height="-1" width="-1"></div>
                      <div><img src="img/1547198235360.jpeg" height="-1" width="-1"></div>
                      <div><img src="img/1547198219157.jpeg" height="-1" width="-1"></div>
                      <div><img src="img/1547198219157.jpeg" height="-1" width="-1"></div>
                    </div>
                </div>    


          </div>
        </div>
        <div class="layui-col-md6">
          <div class="grid-demo grid-demo-bg2" style="background-color: chartreuse">
               <h3>商品名称</h3>  
               <p class="">价格:<span id="goods_price">1888</span></p>
               <p class="">库存<span id="goods_id">4</span></p>
               <input type="hidden" value="" id="goods_id">
               <input type="hidden" value="" id="pruduct_id">

                <table class="layui-table" lay-even="" lay-skin="row">
                        
                          <tr>
                            <th>人物</th>
                            <th>民族</th>
                            <th>出场时间</th>
                            <th>格言</th>
                          </tr> 
                       
                          <tr>
                            <td>贤心</td>
                            <td>汉族</td>
                            <td>1989-10-14</td>
                            <td>人生似修行</td>
                          </tr>
                          <tr>
                            <td>张爱玲</td>
                            <td>汉族</td>
                            <td>1920-09-30</td>
                            <td>于千万人之中遇见你所遇见的人，于千万年之中，时间的无涯的荒野里…</td>
                          </tr>
                          <tr>
                            <td>Helen Keller</td>
                            <td>拉丁美裔</td>
                            <td>1880-06-27</td>
                            <td> Life is either a daring adventure or nothing.</td>
                          </tr>
                          <tr>
                            <td>岳飞</td>
                            <td>汉族</td>
                            <td>1103-北宋崇宁二年</td>
                            <td>教科书再滥改，也抹不去“民族英雄”的事实</td>
                          </tr>
                          <tr>
                            <td>孟子</td>
                            <td>华夏族（汉族）</td>
                            <td>公元前-372年</td>
                            <td>猿强，则国强。国强，则猿更强！ </td>
                          </tr>
                        </tbody>
                      </table>   

              <form class="layui-form" action="">
                <table class="layui-table" lay-even="" lay-skin="row" id="goods_product">
                </table>
                

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input class="layui-btn layui-btn-primary buy_num" type="button" value="+">
                        <input class="layui-btn layui-btn-primary buy_num" type="text" value="1" id="buy_num">
                        <input class="layui-btn layui-btn-primary buy_num" type="button" value="-">
                        <input class="layui-btn" type="button" value="加入购物车" id="add_car" >
                        <input class="layui-btn" type="button" value="立即购买">
                    </div>
                </div>
            </form>


          </div>
        </div>


      </div>
   
  
</div>


</body>
</html>
<script src="./layui//layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use(['carousel', 'form', 'jquery'], function(){
  var carousel = layui.carousel
  ,form = layui.form;
  var $=layui.$;
  

  //图片轮播
  carousel.render({
    elem: '#test10'
    ,width: '778px'
    ,height: '440px'
    ,interval: 4000
  });

     // var goods_id=getUrlParm('goodsId');
     // var goods_id=getUrlParm('goodsId');

      // 获取商品的信息
            $.ajax({
                method: 'get',
                url: 'http://localhost/first/php/public/index.php/index/Goods/getOne',
                dataType: 'json',
                data: {
                    goods_id: goods_id
                },
                success: function (res) {
                    if( res.code == 0 )
                    {
                        $('#goods_name').html( res.data.goods_name )
                        $('#goods_price').html( res.data.goods_price )
                        $('#goods_num').html( res.data.goods_num )

                        $('#goods_id').val( res.data.goods_id )
                    }
                }
            })
  

  
 
  
  
});
</script>